﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using HigLabo.Net.Extensions;
using System.Text.RegularExpressions;
using Newtonsoft.Json.Linq;

namespace HigLabo.Net.Twitter
{
    /// <summary>
    /// 
    /// </summary>
    public class UserEntities : ResponseObject
    {
        /// <summary>
        /// 
        /// </summary>
        public UrlCollection Description { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public UrlCollection Urls { set; get; }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="jsonText"></param>
        public UserEntities(String jsonText)
        {
            this.SetProperty(jsonText);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="jsonText"></param>
        public override void SetProperty(string jsonText)
        {
            var d = this.SetData(jsonText);

            String des = d.ToString("description");
            if (!String.IsNullOrEmpty(des))
            {
                d = this.SetData(des);
                this.Description = new UrlCollection(d.ToString("urls"));
            }
            String url = d.ToString("url");
            if (!String.IsNullOrEmpty(url))
            {
                d = this.SetData(url);
                this.Urls = new UrlCollection(d.ToString("urls"));
            }            
        }
    }
}
